Applied Data Science Capstone

Peer-graded Assignment: Capstone Project - The Battle of Neighborhoods


Introduction/Business Problem


Clearly define a problem or an idea of your choice, where you would need to leverage the Foursquare location data to solve or execute. Remember that data science problems always target an audience and are meant to help a group of stakeholders solve a problem, so make sure that you explicitly describe your audience and why they would care about your problem.

Lehi in Utah is the one of the fastest growing cities in the United State of America. Lehi's nickname, Sillicon Slope, is an attractive place for companies such as Adobe, Microsoft, and Oracle, which have built campuses. Additionally, new startups are growing rapidly in this area. Lehi is close to Salt Lake City International airport and Sundance - where the Sundance film festival is held every winter. Lehi is also famous for it’s beautiful mountains and forest which attracts hikers and outdoor enthusiasts.

However, these various advantages and the increasing number of business travelers and tourists in Lehi face one challenge. One of the problems in this area is public transportation. Lehi’s rapid growth has highlighted an extreme need for improved public transportation - that is not as readily available as places like New York or San Francisco. A tourist wanting to visit the various sites around Lehi would find it difficult to hail a taxi or find a bus to reach their destination. Luckily, we have car sharing systems like Uber and Lyft, and we can also explore the area by utilizing the information from Google map or FourSquare before traveling.

As a travel agency manager, I am going to present this report to one of my clients who is going to visit Lehi for a tech conference in October. This client has never visited Lehi before and plans to stay 3 days. She is participating in the conference on the first day of the trip, and has already booked the hotel - Hyatt Place in Lehi. During her business trip, she wants to go hiking in the mountains or trails to experience the natural fall landscape. She is also planning to go shopping to get souvenirs for her friends and family. I was given the draft planner and charging on completing the planner. In order for her to have a successful business trip, I need to make a plan for the second and third day.

Data


Describe the data that you will be using to solve the problem or execute your idea. Remember that you will need to use the Foursquare location data to solve the problem or execute your idea. You can absolutely use other datasets in combination with the Foursquare location data. So make sure that you provide adequate explanation and discussion, with examples, of the data that you will be using, even if it is only Foursquare location data.

  1. I have researched Google to outline my plan, and was able to reach this website: This website provides general information specially top attractions that visitors can do in Lehi.
  1. I am going to add climate data in Lehi which can help her pack her luggage: As per Wikipedia data, I am going to create a climate data in October. This data will provide some tips like what clothes she needs to prepare.
  1. Using FourSquare’s API, I am going to make a map for recommendation restaurant, shopping areas near the Hotels and hiking places
  1. I am also going to include other placese where the client may consider to go like museums or exhibition.

Methodology


1. I am given a draft planner by my client, need to find a plan, and update the NaN sections.

In [2]:
draft_planner = pd.DataFrame(index=['Morning','Evening','Night'],columns=['Day1','Day2','Day3'])
draft_planner.iloc[0,0] = 'Arriving at Salt Lake City Airport and heading to the hotel'
draft_planner.iloc[1,0] = 'Participating IT conference'
draft_planner.iloc[2,0] = 'Return to the hotel and find a restraunt for dinner'
draft_planner.iloc[2,2] = 'Heading to the airport'
draft_planner
Out[2]:
Day1 Day2 Day3
Morning Arriving at Salt Lake City Airport and heading... NaN NaN
Evening Participating IT conference NaN NaN
Night Return to the hotel and find a restraunt for d... NaN Heading to the airport

2. I researched the weather data in Wikipedia and organized it to data frame.

In [3]:
dfs = pd.read_html('https://en.wikipedia.org/wiki/Lehi,_Utah')
len(dfs) #10 of dataframes are available.

climate = dfs[2]
climate.drop(climate.index[3], inplace=True)
climate
Out[3]:
Climate data for Lehi, Utah
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
0 Average high °F (°C) 37(3) 43(6) 52(11) 61(16) 72(22) 82(28) 90(32) 88(31) 79(26) 64(18) 48(9) 39(4) 63(17)
1 Average low °F (°C) 16(−9) 19(−7) 28(−2) 34(1) 41(5) 48(9) 55(13) 54(12) 45(7) 34(1) 25(−4) 18(−8) 35(2)
2 Average precipitation inches (mm) 0.98(24.9) 1.00(25.4) 1.12(28.4) 1.3(33) 1.40(35.6) 0.66(16.8) 0.7(17) 0.98(24.9) 1.15(29.2) 1.33(33.8) 1.13(28.7) 0.69(17.5) 12.44(315.2)
In [6]:
climate_oct.rename({0:'Average high °F (°C)', 1: 'Average low °F (°C)',2:'Average precipitation inches (mm)'}, axis='index', inplace=True)
climate_oct.rename({'Oct':'October'}, axis=1,inplace=True)
climate_oct
Out[6]:
Climate data for Lehi, Utah
October
Average high °F (°C) 64(18)
Average low °F (°C) 34(1)
Average precipitation inches (mm) 1.33(33.8)

Based on data, the client can expect comfortable autumn weather in Lehi. However,she may need to pack a winter jacket because the temperture could get dropped as below as 34°F.


3. I used the first data source to find general traveling knowledge of Lehi, UT and organized the location data by the client's preference to data frame.

In [7]:
trip_lehi = pd.DataFrame({'Name of the place': ['Thanks Giving Point','Museum of Natural Curiosity', 'Museum of Ancient Life','Outlets at Traverse Mountain','Ashton Gardens','Hutchings Museum',"Cornbelly's Corn Maze & Pumpkin Fest",'Glass Art Institute at Thanksgiving Point','Lehi Roller Mills','Butterfly Biosphere','Pointe Meadow Park'],
                          'Category': ['Specialty Museums',"Children's Museums",'Natural History Museums','Factory Outlets','Scenic Walking Areas','Museum','Farms','Art Galleries','Historic Sites','Science Museums','Parks'],
                         'Hours':['Mon - Sat 10:00 AM - 8:00 PM','Mon - Sat 10:00 AM - 8:00 PM','Mon - Sat 10:00 AM - 8:00 PM','Mon - Sat 10:00 AM - 9:00 PM, Sun 11:00 AM - 6:00 PM','Temporarily closed','Mon - Sat 11:00 AM - 8:30 PM',np.nan,np.nan,np.nan,np.nan,np.nan]})
trip_lehi
Out[7]:
Name of the place Category Hours
0 Thanks Giving Point Specialty Museums Mon - Sat 10:00 AM - 8:00 PM
1 Museum of Natural Curiosity Children's Museums Mon - Sat 10:00 AM - 8:00 PM
2 Museum of Ancient Life Natural History Museums Mon - Sat 10:00 AM - 8:00 PM
3 Outlets at Traverse Mountain Factory Outlets Mon - Sat 10:00 AM - 9:00 PM, Sun 11:00 AM - 6...
4 Ashton Gardens Scenic Walking Areas Temporarily closed
5 Hutchings Museum Museum Mon - Sat 11:00 AM - 8:30 PM
6 Cornbelly's Corn Maze & Pumpkin Fest Farms NaN
7 Glass Art Institute at Thanksgiving Point Art Galleries NaN
8 Lehi Roller Mills Historic Sites NaN
9 Butterfly Biosphere Science Museums NaN
10 Pointe Meadow Park Parks NaN
In [8]:
#Remove the rows with NaN in Hours columns.
trip_lehi.dropna(inplace=True)
In [9]:
#Also remove the rows with 'Temporarily closed' in hours columns
trip_lehi.drop(index=4, inplace=True, axis=0)
In [10]:
trip_lehi
Out[10]:
Name of the place Category Hours
0 Thanks Giving Point Specialty Museums Mon - Sat 10:00 AM - 8:00 PM
1 Museum of Natural Curiosity Children's Museums Mon - Sat 10:00 AM - 8:00 PM
2 Museum of Ancient Life Natural History Museums Mon - Sat 10:00 AM - 8:00 PM
3 Outlets at Traverse Mountain Factory Outlets Mon - Sat 10:00 AM - 9:00 PM, Sun 11:00 AM - 6...
5 Hutchings Museum Museum Mon - Sat 11:00 AM - 8:30 PM

As per the client's request, I added 'Outlets at Traverse Mountain' to the plan. The museums such as 'Thanks Giving Point', 'Museum of Ancient Life' and 'Hutchings Museum' are the options I could consider.

4. In order to get the distances data, I used FourSquare’s API and display the map of the location for visualization purpose. I also include reviews of the location by using FourSqure’s API to give the client options to choose for her trip.

4-1. Restraunt Options:
In [17]:
# Removed unnecessary data and sorted the data by distance.
dataframe_food_filtered.drop(columns=['postalCode','cc','country'], inplace=True)
dataframe_food_filtered.sort_values(by='distance',axis=0, ascending=True)
dataframe_food_filtered
Out[17]:
name categories address lat lng labeledLatLngs distance city state formattedAddress crossStreet id
0 Harvest Restaurant New American Restaurant 3003 N Thanksgiving Way 40.425914 -111.887108 [{'label': 'display', 'lat': 40.42591376009597... 864 Lehi UT [3003 N Thanksgiving Way, Lehi, UT 84043, Unit... NaN 4b9e7701f964a52037e636e3
1 Tsunami Restaurant & Sushi Bar Sushi Restaurant 1616 W Traverse Pkwy 40.432669 -111.875990 [{'label': 'display', 'lat': 40.43266888450752... 471 Lehi UT [1616 W Traverse Pkwy, Lehi, UT 84043, United ... NaN 57c38bd4498e726a0aa53f59
2 La Fuente Restaurant Mexican Restaurant 101 N 1200 E #A6 40.389476 -111.827382 [{'label': 'display', 'lat': 40.38947575958743... 6628 Lehi UT [101 N 1200 E #A6, Lehi, UT 84043, United States] NaN 4cc2467eb2beb1f7b1150f4c
3 Jim's Family Restaurant American Restaurant 1728 W Park Ave 40.519226 -111.939243 [{'label': 'display', 'lat': 40.51922600067426... 10827 Riverton UT [1728 W Park Ave (at S Redwood Rd), Riverton, ... at S Redwood Rd 4c9cee567c096dcbc33ec6d1
4 Jim's Family Restaurant American Restaurant 834 E State Rd 40.371173 -111.775524 [{'label': 'display', 'lat': 40.37117345531693... 11281 American Fork UT [834 E State Rd, American Fork, UT 84003, Unit... NaN 4b5e799af964a5202e9029e3
5 A&W Restaurant Fast Food Restaurant 439 E State St 40.374035 -111.786482 [{'label': 'display', 'lat': 40.37403492111159... 10353 American Fork UT [439 E State St, American Fork, UT 84003, Unit... NaN 4e4de704bd4101d0d79dc61a
6 A&W Restaurant Fast Food Restaurant 674 E 12300 S 40.526531 -111.872257 [{'label': 'display', 'lat': 40.526531, 'lng':... 10505 Draper UT [674 E 12300 S, Draper, UT 84020, United States] NaN 4e4de705bd4101d0d79dc630
7 A&W Restaurant Fast Food Restaurant 1827 W 12600 S 40.520950 -111.940086 [{'label': 'display', 'lat': 40.52095, 'lng': ... 11031 Riverton UT [1827 W 12600 S, Riverton, UT 84065, United St... NaN 4f43ec9519836ed0019142da
8 Corenas Restaurant Food 288 W Main St 40.388008 -111.853455 [{'label': 'entrance', 'lat': 40.387927, 'lng'... 5487 Lehi UT [288 W Main St, Lehi, UT 84043, United States] NaN 4f3236ca19836c91c7c161ca
9 Temptasian Restaurant Asian Restaurant 987 W 500 N 40.388552 -111.824083 [{'label': 'display', 'lat': 40.38855213843044... 6897 American Fork UT [987 W 500 N, American Fork, UT 84003, United ... NaN 51bb7d967dd2f04dd823b0a0
10 IKEA Furniture / Home Store 67 W Ikea Way 40.509145 -111.893514 [{'label': 'display', 'lat': 40.50914451010241... 8600 Draper UT [67 W Ikea Way, Draper, UT 84020, United States] NaN 4afb632cf964a520931d22e3
11 Taco Rodriguez Mexican Restaurant Mexican Restaurant 74 N West State Rd 40.377773 -111.812496 [{'label': 'display', 'lat': 40.37777266009024... 8442 American Fork UT [74 N West State Rd, American Fork, UT 84003, ... NaN 4e4ca589bd413c4cc66b013a
12 IHOP Breakfast Spot 925 W State Rd 40.386814 -111.822578 [{'label': 'display', 'lat': 40.3868141230456,... 7124 American Fork UT [925 W State Rd, American Fork, UT 84003, Unit... NaN 4bc3d759f8219c74e8bbb610
13 Mi Ranchito Mexican Restaurant 396 E State Rd 40.374306 -111.788384 [{'label': 'display', 'lat': 40.37430619028417... 10208 American Fork UT [396 E State Rd, American Fork, UT 84003, Unit... NaN 4c5dfe3a6147be9ae2cf9309
14 Thai Land Restaurant Thai Restaurant 126 W 12300 S #D 40.527395 -111.894566 [{'label': 'display', 'lat': 40.52739467302235... 10629 Draper UT [126 W 12300 S #D, Draper, UT 84020, United St... NaN 4bfd6ad72b83b7136eb6a998
15 Guadalahonky's Mexican Restaurant 136 E 12300 S 40.526409 -111.886976 [{'label': 'display', 'lat': 40.52640937179229... 10472 Draper UT [136 E 12300 S, Draper, UT 84020, United States] NaN 4b1aca1ff964a520d2f123e3
16 JCW's The Burger Boys Burger Joint 580 E State Rd 40.373036 -111.783216 [{'label': 'display', 'lat': 40.37303584472249... 10638 American Fork UT [580 E State Rd, American Fork, UT 84003, Unit... NaN 4b50dc6df964a520c13527e3
17 Aroma Indian Cuisine Indian Restaurant 715 E 12300 S 40.527468 -111.870776 [{'label': 'display', 'lat': 40.52746831517926... 10619 Draper UT [715 E 12300 S (at 700 E), Draper, UT 84020, U... at 700 E 4b9ad790f964a52038db35e3
18 Walter's Restaurant Italian Restaurant NaN 40.322205 -111.900345 [{'label': 'display', 'lat': 40.322205, 'lng':... 12372 Lehi UT [Lehi, UT 84043, United States] NaN 4c269e01c11dc9b6e15a2924
19 China Isle Chinese Restaurant 323 S 500 E 40.370530 -111.784923 [{'label': 'display', 'lat': 40.37053018836529... 10703 American Fork UT [323 S 500 E, American Fork, UT 84003, United ... NaN 4b8eb50af964a520453233e3
In [18]:
# Visualized the map: 

venues_food_map = folium.Map(location=[latitude_hotel, longitude_hotel], zoom_start=12) # generated map centred around Hyatt Place

# added a red circle marker to represent Hyatt Place
folium.CircleMarker(
    [latitude_hotel, longitude_hotel],
    radius=10,
    color='red',
    popup='Hyatt Place',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(venues_food_map)

# added the restaurants as blue circle markers
for lat, lng, label in zip(dataframe_food_filtered.lat, dataframe_food_filtered.lng, dataframe_food_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='blue',
        popup=label,
        fill = True,
        fill_color='blue',
        fill_opacity=0.6
    ).add_to(venues_food_map)

# display map
venues_food_map
Out[18]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Two restraunts near the hotel returned. One is sushi restaurant and New American Restaurant. I looked the the reviews to find better option.

4-1-a. Tsunami Restaurant & Sushi Bar

In [21]:
# Overall Rating
try:
    print('The rating is', result_sushi['response']['venue']['rating'])
except:
    print('This venue has not been rated yet.')
The rating is 8.3
In [24]:
pd.set_option('display.max_colwidth',None)

tips_df = pd.json_normalize(tips) # json normalize tips

# columns to keep
filtered_columns = ['text', 'agreeCount', 'disagreeCount', 'id', 'user.firstName', 'user.lastName', 'user.id']
tips_filtered = tips_df.loc[:, filtered_columns]

# display tips
tips_filtered.reindex()
Out[24]:
text agreeCount disagreeCount id user.firstName user.lastName user.id
0 nice.. they have many variant of sushi 2 0 58e2b9241d21ba36f262bfa0 Fathia A 5030073

Based on the distance, rating, and review, I decided to add the sushi restaurant to the plan.


4-1-b. Harvest Restaurant

In [26]:
# Rating: 
try:
    print('The rating is', result_harvest['response']['venue']['rating'])
except:
    print('This venue has not been rated yet.')
The rating is 6.9
In [29]:
pd.set_option('display.max_colwidth',None)

tips_df_harvest = pd.json_normalize(tips) # json normalize tips

# columns to keep
filtered_columns = ['text', 'agreeCount', 'disagreeCount', 'id', 'user.firstName', 'user.lastName', 'user.id']
tips_filtered_harvest = tips_df_harvest.loc[:, filtered_columns]

# display tips
tips_filtered_harvest.reindex()
Out[29]:
text agreeCount disagreeCount id user.firstName user.lastName user.id
0 Service was impeccable. I had the pork porterhouse. Cooked to perfection with amazing sauce. Aly had the salmon. Crispy on the outside and melted like butter in the mouth. Both served searing hot! 2 0 562cd43b498e18acffd9aa7e Darrin A 142323949

Although the rating is lower than sushi restaurant, the review is not bad. I decided to add this restaurant for option.


4-1-c. I explored around the sushi restaurant to find out more restaurant options for the client.

In [32]:
import requests
results_what_to_do_sushi = requests.get(url).json()
'There are {} around Sushi restaurant.'.format(len(results_what_to_do_sushi['response']['groups'][0]['items']))
Out[32]:
'There are 30 around Sushi restaurant.'
In [36]:
# Sorted the places near the sushi restaurant by distance.
df_what_to_do_sushi_filtered.sort_values(by=['distance'], ascending=True, inplace= True)
df_what_to_do_sushi_filtered
Out[36]:
name categories address lat lng labeledLatLngs distance postalCode cc city state country formattedAddress crossStreet id
1 Tsunami Restaurant & Sushi Bar Sushi Restaurant 1616 W Traverse Pkwy 40.432669 -111.875990 [{'label': 'display', 'lat': 40.43266888450752, 'lng': -111.87599013825452}] 3 84043 US Lehi UT United States [1616 W Traverse Pkwy, Lehi, UT 84043, United States] NaN 57c38bd4498e726a0aa53f59
4 The Original Pancake House Breakfast Spot 1674 W Traverse Pkwy 40.432462 -111.876887 [{'label': 'display', 'lat': 40.432462, 'lng': -111.876887}] 79 84043 US Lehi UT United States [1674 W Traverse Pkwy, Lehi, UT 84043, United States] NaN 5c81591fdd12f8003907bc34
0 Harmons Grocery Grocery Store 3450 N Triumph Blvd 40.433407 -111.878484 [{'label': 'display', 'lat': 40.43340686612135, 'lng': -111.87848384934372}] 224 84043 US Lehi UT United States [3450 N Triumph Blvd, Lehi, UT 84043, United States] NaN 571511ba498e153edf795c05
19 Cafe Rio Mexican Grill Mexican Restaurant 1851 W Traverse Parkway Suite D 40.432305 -111.880030 [{'label': 'display', 'lat': 40.43230458173435, 'lng': -111.88002984952297}] 344 NaN US Lehi UT United States [1851 W Traverse Parkway Suite D, Lehi, UT, United States] NaN 58054bb538fa04b4a1ec919f
24 Hyatt Place Salt Lake City/Lehi Hotel 3700 N Outlet Parkway 40.432499 -111.881725 [{'label': 'display', 'lat': 40.432498996812626, 'lng': -111.88172453970638}, {'label': 'entrance', 'lat': 40.432363, 'lng': -111.881727}] 485 84043 US Lehi UT United States [3700 N Outlet Parkway, Lehi, UT 84043, United States] NaN 569c839f498e3954b72afae8
14 Bona Vita Italian Bistro Italian Restaurant 1820 West Traverse Parkway, Suite C 40.434983 -111.882987 [{'label': 'display', 'lat': 40.43498274457547, 'lng': -111.88298685379614}] 644 84043 US Lehi UT United States [1820 West Traverse Parkway, Suite C (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] at Outlets at Traverse Mountain 52b73d68498e8c662c72fc49
25 Nike Factory Store Sporting Goods Shop 3700 N Cabelas Blvd Ste 301 40.434596 -111.884012 [{'label': 'display', 'lat': 40.4345955, 'lng': -111.8840122}, {'label': 'entrance', 'lat': 40.43493, 'lng': -111.88289}] 710 84043 US Lehi UT United States [3700 N Cabelas Blvd Ste 301 (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] at Outlets at Traverse Mountain 50b96068e4b0136726d946a8
11 Outlets At Traverse Mountain Shopping Mall 3700 N Cabelas Blvd 40.434773 -111.884057 [{'label': 'display', 'lat': 40.43477262880914, 'lng': -111.88405708602524}] 720 84043 US Lehi UT United States [3700 N Cabelas Blvd, Lehi, UT 84043, United States] NaN 508ea8aae4b07c9fb26ca367
17 Coach Factory Outlet Accessories Store 3700 N Cabelas Blvd #400 40.435988 -111.884281 [{'label': 'display', 'lat': 40.435988166050926, 'lng': -111.88428089814758}] 791 84043 US Lehi UT United States [3700 N Cabelas Blvd #400, Lehi, UT 84043, United States] NaN 50b95d0de4b080f3ffc0dd2c
5 Chick-fil-A Food Service 3470 N Digital Dr 40.430977 -111.886214 [{'label': 'display', 'lat': 40.4309768, 'lng': -111.8862139}] 886 84043 US Lehi UT United States [3470 N Digital Dr, Lehi, UT 84043, United States] NaN 59c91fd82d2fd975642620e8
12 Blaze Pizza Pizza Place 3370 N Digital Dr, #100 40.429872 -111.886280 [{'label': 'display', 'lat': 40.429872, 'lng': -111.88628}] 926 84043 US Lehi UT United States [3370 N Digital Dr, #100, Lehi, UT 84043, United States] NaN 5745eee7498e4bcf736179f5
10 Village Baker Sandwich Place NaN 40.429115 -111.885889 [{'label': 'display', 'lat': 40.42911511965557, 'lng': -111.88588891510972}] 928 84043 US Lehi UT United States [Lehi, UT 84043, United States] NaN 57167ea0498e15f35e5eac5d
27 Slapfish Seafood Restaurant 3320 N Digital Dr 40.429053 -111.886145 [{'label': 'display', 'lat': 40.429053, 'lng': -111.886145}, {'label': 'entrance', 'lat': 40.429051, 'lng': -111.886457}] 950 NaN US Lehi UT United States [3320 N Digital Dr, Lehi, UT, United States] NaN 58bb267515fb437fcfa058ef
16 Cabela's Sporting Goods Shop 2502 W Cabelas Blvd 40.437689 -111.888870 [{'label': 'display', 'lat': 40.4376889017244, 'lng': -111.8888703022019}] 1223 84043 US Lehi UT United States [2502 W Cabelas Blvd, Lehi, UT 84043, United States] NaN 4b32adcef964a520b21125e3
6 Museum of Ancient Life History Museum 2929 N Thanksgiving Way 40.424669 -111.885937 [{'label': 'display', 'lat': 40.42466911851144, 'lng': -111.88593655766621}] 1228 84043 US Lehi UT United States [2929 N Thanksgiving Way (at Thanksgiving Point), Lehi, UT 84043, United States] at Thanksgiving Point 4bc74aab14d795218c1467e9
2 Megaplex 8 Multiplex 3003 N Thanksgiving Way 40.423772 -111.884988 [{'label': 'display', 'lat': 40.42377234984366, 'lng': -111.8849884095624}] 1252 84043 US Lehi UT United States [3003 N Thanksgiving Way (at Thanksgiving Point), Lehi, UT 84043, United States] at Thanksgiving Point 4bbe21c7b42aef3b78764bc3
8 Farm Country Museum 3003 N Thanksgiving Way 40.424153 -111.888731 [{'label': 'display', 'lat': 40.424153, 'lng': -111.888731}] 1438 84043 US Lehi UT United States [3003 N Thanksgiving Way, Lehi, UT 84043, United States] NaN 4ad4f28ff964a5205afd20e3
7 Cornbelly's Corn Maze & Pumpkin Fest General Entertainment 3003 N Thanksgiving Way 40.424819 -111.889933 [{'label': 'display', 'lat': 40.42481904954279, 'lng': -111.8899334219279}] 1470 84043 US Lehi UT United States [3003 N Thanksgiving Way (at Thanksgiving Point), Lehi, UT 84043, United States] at Thanksgiving Point 4ca7673d14c337043439c93b
13 Thanksgiving Point Event Space 3003 N Thanksgiving Point Dr 40.429220 -111.893079 [{'label': 'display', 'lat': 40.42922013711716, 'lng': -111.89307856125023}] 1498 84043 US Lehi UT United States [3003 N Thanksgiving Point Dr, Lehi, UT 84043, United States] NaN 4b984505f964a520883835e3
29 Electric Park at Thanksgiving Point Event Space 3003 N Thanksgiving Way 40.422223 -111.887207 [{'label': 'display', 'lat': 40.42222344680218, 'lng': -111.88720690001271}] 1503 84043 US Lehi UT United States [3003 N Thanksgiving Way, Lehi, UT 84043, United States] NaN 4bbf7caaabf49521a3b7bd93
3 J Dawgs Hot Dog Joint 3750 N Thanksgiving Way Ste B 40.434012 -111.894753 [{'label': 'display', 'lat': 40.43401191044417, 'lng': -111.89475277171255}] 1595 84043 US Lehi UT United States [3750 N Thanksgiving Way Ste B, Lehi, UT 84043, United States] NaN 5377ab78498eeb0c41739414
28 SLAB Pizza Pizza Place 3430 N Ashton Blvd 40.430219 -111.895237 [{'label': 'display', 'lat': 40.430219, 'lng': -111.895237}] 1653 84043 US Lehi UT United States [3430 N Ashton Blvd, Lehi, UT 84043, United States] NaN 56187ae5498ee34e4b4e94d8
20 Starbucks Coffee Shop 2951 W Clubhouse Lane Ste A 40.430961 -111.896157 [{'label': 'display', 'lat': 40.43096068, 'lng': -111.8961572}, {'label': 'entrance', 'lat': 40.430936, 'lng': -111.896179}] 1718 84043 US Lehi UT United States [2951 W Clubhouse Lane Ste A, Lehi, UT 84043, United States] NaN 523c7c3a498e8150b97cd213
26 Mo' Bettahs Hawaiian Restaurant 2975 W Clubhouse Dr 40.430900 -111.897169 [{'label': 'display', 'lat': 40.43090047883428, 'lng': -111.8971689716673}] 1804 84043 US Lehi UT United States [2975 W Clubhouse Dr, Lehi, UT 84043, United States] NaN 542c4af1498e97eaa6ef59b2
9 Home2 Suites by Hilton Hotel 3051 W Clubhouse Dr 40.430501 -111.897949 [{'label': 'display', 'lat': 40.430501303452196, 'lng': -111.8979486823082}] 1875 84043 US Lehi UT United States [3051 W Clubhouse Dr, Lehi, UT 84043, United States] NaN 53de52d3498ea67e4e0b4ee6
18 Jimmy John's Sandwich Place 3501 N Center St 40.431432 -111.850463 [{'label': 'display', 'lat': 40.43143159278898, 'lng': -111.85046341301255}] 2168 84043 US Lehi UT United States [3501 N Center St, Lehi, UT 84043, United States] NaN 4bc5113d22c676b0959196d3
21 Beany's To Go Coffee Shop 2020 N State St. 40.412323 -111.869362 [{'label': 'display', 'lat': 40.41232307887606, 'lng': -111.86936180550599}] 2337 84003 US Lehi UT United States [2020 N State St., Lehi, UT 84003, United States] NaN 551c0612498e496f8a5da221
23 Museum of Natural Curiosity Science Museum 3605 N Garden Dr 40.432424 -111.908114 [{'label': 'display', 'lat': 40.43242386356498, 'lng': -111.90811404990792}, {'label': 'entrance', 'lat': 40.432365, 'lng': -111.908019}] 2721 84043 US Lehi UT United States [3605 N Garden Dr, Lehi, UT 84043, United States] NaN 530beecc498e5c68f4b04f26
15 Ashton Gardens Garden 3900 N Garden Dr 40.435576 -111.911395 [{'label': 'display', 'lat': 40.43557601484623, 'lng': -111.91139471943653}] 3016 84043 US Lehi UT United States [3900 N Garden Dr, Lehi, UT 84043, United States] NaN 4bc7a9e66501c9b6deec3e29
22 Kneaders Bakery 1384 E State Road 92 40.431432 -111.827623 [{'label': 'display', 'lat': 40.43143244286722, 'lng': -111.82762314170077}] 4101 84043 US Lehi UT United States [1384 E State Road 92, Lehi, UT 84043, United States] NaN 4b5f0d4cf964a520e4a329e3

New dataset shows there are more restaurant near the sushi place. For example, there are breakfast place 'The Original Pancake House' and mexican restaurant 'Cafe Rio Mexican Grill' . I am going to add these places for the options in case the client wants to experience variety food.

4-2 Shopping Options:
In [40]:
# keep only columns that include venue name, and anything that is associated with location
filtered_columns = ['name', 'categories'] + [col for col in dataframe_shopping.columns if col.startswith('location.')] + ['id']
dataframe_shopping_filtered = dataframe_shopping.loc[:, filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
dataframe_shopping_filtered['categories'] = dataframe_shopping_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
dataframe_shopping_filtered.columns = [column.split('.')[-1] for column in dataframe_shopping_filtered.columns]

dataframe_shopping_filtered
Out[40]:
name categories address crossStreet lat lng labeledLatLngs distance postalCode cc city state country formattedAddress id
0 Nike Factory Store Sporting Goods Shop 3700 N Cabelas Blvd Ste 301 at Outlets at Traverse Mountain 40.434596 -111.884012 [{'label': 'display', 'lat': 40.4345955, 'lng': -111.8840122}, {'label': 'entrance', 'lat': 40.43493, 'lng': -111.88289}] 319 84043 US Lehi UT United States [3700 N Cabelas Blvd Ste 301 (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] 50b96068e4b0136726d946a8
1 The UPS Store Shipping Store 1881 W Traverse Pkwy, Ste E NaN 40.433490 -111.880503 [{'label': 'display', 'lat': 40.4334905, 'lng': -111.8805034}] 148 84043 US Lehi UT United States [1881 W Traverse Pkwy, Ste E, Lehi, UT 84043, United States] 57c73d7f498e1ebef797d3ad
2 Polo Ralph Lauren Factory Store Clothing Store 3700 N Cabelas Blvd at Outlets at Traverse Mountain 40.434660 -111.884388 [{'label': 'display', 'lat': 40.4346596, 'lng': -111.8843884}, {'label': 'entrance', 'lat': 40.43493, 'lng': -111.88289}] 346 84043 US Lehi UT United States [3700 N Cabelas Blvd (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] 50b931f400cad8a2332f7d77
3 Columbia Factory Store Clothing Store 3700 North Cabelas Blvd Ste 450 NaN 40.435163 -111.884080 [{'label': 'display', 'lat': 40.4351634, 'lng': -111.8840798}] 373 84043 US Lehi UT United States [3700 North Cabelas Blvd Ste 450, Lehi, UT 84043, United States] 5b9a5ba4b23dfa002c7c6d77
4 Gap Factory Store Clothing Store 3700 N Cabelas Blvd at Outlets at Traverse Mountain 40.435032 -111.884605 [{'label': 'entrance', 'lat': 40.43493, 'lng': -111.88289}, {'label': 'display', 'lat': 40.43503189086914, 'lng': -111.88460540771484}] 389 84043 US Lehi UT United States [3700 N Cabelas Blvd (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] 50c277aee4b0309a637d7ec0
5 Levi's Outlet Store Clothing Store 3700 N Cabelas Blvd #405 at Outlets at Traverse Mountain 40.435395 -111.884247 [{'label': 'display', 'lat': 40.435395, 'lng': -111.884247}] 402 84043 US Lehi UT United States [3700 N Cabelas Blvd #405 (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] 50c3a5ece4b0c5b6f417c422
6 T-Mobile Mobile Phone Shop 1899 W Traverse Pkwy NaN 40.434077 -111.880590 [{'label': 'display', 'lat': 40.434076786754616, 'lng': -111.88059002588913}] 201 84043 US Lehi UT United States [1899 W Traverse Pkwy, Lehi, UT 84043, United States] 5cb455c63092be002c4fe6ee
7 J.Crew Factory Clothing Store 3700 N Cabelas Blvd #258 at Outlets at Traverse Mountain 40.435259 -111.885105 [{'label': 'display', 'lat': 40.435259, 'lng': -111.8851047}] 436 84043 US Lehi UT United States [3700 N Cabelas Blvd #258 (at Outlets at Traverse Mountain), Lehi, UT 84043, United States] 50b95b5ae4b0c22ba939ee62
8 American Eagle Outlet Clothing Store 3700 North Cabelas Blvd, Suite 274 NaN 40.434935 -111.885587 [{'label': 'display', 'lat': 40.434935, 'lng': -111.8855875}] 442 84043 US Lehi UT United States [3700 North Cabelas Blvd, Suite 274, Lehi, UT 84043, United States] 542ae3a0498e8525dcecab34
9 AT&T Mobile Phone Shop 3370 N Digital Dr Ste 130 NaN 40.429942 -111.886053 [{'label': 'display', 'lat': 40.429941881026295, 'lng': -111.88605308532715}] 471 84043 US Lehi UT United States [3370 N Digital Dr Ste 130, Lehi, UT 84043, United States] 5a94fc548c35dc4bbb7e5073
10 Tommy Hilfiger Clothing Store 3940 N Traverse Mountain Blvd NaN 40.436501 -111.880363 [{'label': 'display', 'lat': 40.436500549316406, 'lng': -111.88036346435547}] 464 84043 US Lehi UT United States [3940 N Traverse Mountain Blvd, Lehi, UT 84043, United States] 50ad27da011cc0acf76d862c
In [41]:
# Visualized the map: 

shopping_map = folium.Map(location=[latitude_hotel, longitude_hotel], zoom_start=15) # generate map centred around Hyatt Place


# add a red circle marker to represent Hyatt Place
folium.CircleMarker(
    [latitude_hotel, longitude_hotel],
    radius=10,
    color='red',
    popup='Hyatt Place',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(shopping_map)

# add the outlet as purple circle markers
for lat, lng, label in zip(dataframe_shopping_filtered.lat, dataframe_shopping_filtered.lng, dataframe_shopping_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='purple',
        popup=label,
        fill = True,
        fill_color='purple',
        fill_opacity=0.6
    ).add_to(shopping_map)

# # display map
shopping_map
Out[41]:
Make this Notebook Trusted to load map: File -> Trust Notebook

The map displays that the outlet and shopping areas are closed to the hotel. I am confident to add this shopping data to part of the planner.

4-3 Hiking area Options:
In [46]:
# Removed unnecessary data such as None, Playground and Travel Agency in the categories.

dataframe_hiking_filtered.drop([2,3,5], inplace=True)
In [47]:
# Sorted data by distance
dataframe_hiking_filtered.sort_values(by=['distance'], ascending=True,inplace=True)
In [48]:
dataframe_hiking_filtered.head()
Out[48]:
name categories lat lng labeledLatLngs distance postalCode cc city state country formattedAddress address crossStreet id
0 Lehi Rail Trail Bike Trail 40.431210 -111.883919 [{'label': 'display', 'lat': 40.43121, 'lng': -111.883919}] 242 84043 US Lehi UT United States [Lehi, UT 84043, United States] NaN NaN 592c5d995ba0462fdb7fdb17
1 Murdock Canal Trail - Traverse Mountain Bike Trail 40.431730 -111.873820 [{'label': 'display', 'lat': 40.43173, 'lng': -111.87382}] 659 NaN US Lehi UT United States [Lehi, UT, United States] NaN NaN 5865365d45005e7adc48d64e
6 Sensei Trail Trail 40.458173 -111.867998 [{'label': 'display', 'lat': 40.458173, 'lng': -111.867998}] 3087 84043 US Lehi UT United States [Lehi, UT 84043, United States] NaN NaN 5e8e24d410e07e0007192129
4 Dry Creek Trail Park Park 40.407081 -111.851063 [{'label': 'display', 'lat': 40.40708059832424, 'lng': -111.85106305965795}] 3825 84043 US Lehi UT United States [Lehi, UT 84043, United States] NaN NaN 4f726437e4b0e3a995eda14a
7 West Bluff Off-Leash Trail Trail 40.471428 -111.852020 [{'label': 'display', 'lat': 40.471428, 'lng': -111.85202}] 5010 84020 US Draper UT United States [Draper, UT 84020, United States] NaN NaN 5f32cf6948c64a2e52b7a049
In [49]:
# Visualized the places: 
hiking_map = folium.Map(location=[latitude_hotel, longitude_hotel], zoom_start=11) # generate map centred around the Hyatt Place.

# add a red circle marker to represent the Hyatt Place
folium.CircleMarker(
    [latitude_hotel, longitude_hotel],
    radius=10,
    color='red',
    popup='Hyatt Place',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(hiking_map)

# add the hiking areas as green circle markers
for lat, lng, label in zip(dataframe_hiking_filtered.lat, dataframe_hiking_filtered.lng, dataframe_hiking_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='green',
        popup=label,
        fill = True,
        fill_color='green',
        fill_opacity=0.6
    ).add_to(hiking_map)

# display map
hiking_map
Out[49]:
Make this Notebook Trusted to load map: File -> Trust Notebook

There are three tails and one park in Lehi according to the data table. I am going to research related webpages or the pictures of each of places and suggest to the client.

4-3-a. Lehi Rail Trail

Link to Lehi Rail Trail

4-3-b. Murdock Canal Trail - Traverse Mountain

In [50]:
# Pictures of Murdock Canal Trail
murdock_pic1 = Image.open(requests.get('https://www.utahmountainbiking.com/trails/images/pics-trails/Murdock02.jpg', stream=True).raw)
murdock_pic2 = Image.open(requests.get('https://saltproject.co/sites/default/files/images/Lindon/MurdockTrail/Murdock%20Canal%2016.jpg', stream=True).raw)

murdock_pic1
Out[50]:
In [51]:
murdock_pic2
Out[51]:

4-3-c. Sensei Trail

Link to Sensei Trail

In [52]:
# Pictures of Sensei Trail
sensei_pic1 = Image.open(requests.get('https://www.lehi-ut.gov/wp-content/uploads/2019/05/Branden-Henline-Trail-photo.jpg', stream=True).raw)
sensei_pic1
Out[52]:
In [53]:
sensei_pic2 = Image.open(requests.get('http://www.utahmountainbiking.com/trails/images/pics-trails/TraverseMtn09.jpg', stream=True).raw)
sensei_pic2
Out[53]:
In [54]:
sensei_pic3 = Image.open(requests.get('https://i0.wp.com/www.lehifreepress.com/wp-content/uploads/2019/05/Sensei-Trail-Image-4-provided-by-TMTA-1.jpg?fit=1256%2C595&ssl=1', stream=True).raw)
sensei_pic3
Out[54]:

4-3-d. Dry Creek Trail Park

In [55]:
# Pictures of Dry Creek Trail Park
drycreek_pic1 = Image.open(requests.get('https://utahsadventurefamily.com/wp-content/uploads/2016/03/IMG_5211-1140x855.jpg', stream=True).raw)
drycreek_pic1
Out[55]:
In [56]:
drycreek_pic2 = Image.open(requests.get('https://scontent-sjc3-1.xx.fbcdn.net/v/t1.0-9/64687247_2056413144484608_296335116878217216_n.jpg?_nc_cat=105&ccb=2&_nc_sid=8bfeb9&_nc_ohc=WUSyQCQp37kAX_hMFp_&_nc_ht=scontent-sjc3-1.xx&oh=b77008fc60c1059bf8ddfdcb8050bb2b&oe=5FC47C85', stream=True).raw)
drycreek_pic2
Out[56]:

Results


Based on the reseached data, I was able to create the map around the hotel and completed the planner the client may prefer.

1. Map:

In [57]:
venues_map = folium.Map(location=[latitude_hotel, longitude_hotel], zoom_start=15) 

# red circle represents the Hyatt Place.
folium.CircleMarker(
    [latitude_hotel, longitude_hotel],
    radius=10,
    color='red',
    popup='Hyatt Place',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(venues_map)


# green circles represent the trails.
for lat, lng, label in zip(dataframe_hiking_filtered.lat, dataframe_hiking_filtered.lng, dataframe_hiking_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='green',
        popup=label,
        fill = True,
        fill_color='green',
        fill_opacity=0.6
    ).add_to(venues_map)

# blue circles represent the restaurants.
for lat, lng, label in zip(dataframe_food_filtered.lat, dataframe_food_filtered.lng, dataframe_food_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='blue',
        popup=label,
        fill = True,
        fill_color='blue',
        fill_opacity=0.6
    ).add_to(venues_map)

# purple circles represent the shopping areas. 
for lat, lng, label in zip(dataframe_shopping_filtered.lat, dataframe_shopping_filtered.lng, dataframe_shopping_filtered.categories):
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='purple',
        popup=label,
        fill = True,
        fill_color='purple',
        fill_opacity=0.6
    ).add_to(venues_map)

    
# display map
venues_map
Out[57]:
Make this Notebook Trusted to load map: File -> Trust Notebook

2. Planner

In [58]:
option_planner = draft_planner
option_planner
Out[58]:
Day1 Day2 Day3
Morning Arriving at Salt Lake City Airport and heading to the hotel NaN NaN
Evening Participating IT conference NaN NaN
Night Return to the hotel and find a restraunt for dinner NaN Heading to the airport
In [59]:
option_planner.loc[['Night'],['Day1']]= 'Return to the hotel and have a dinner at Tsunami Restaurant & Sushi Bar'
option_planner.loc[['Morning'],['Day2']]= 'Have a breakfast at The Original Pancake House and go for a walk at Murdock Canal Trail - Traverse Mountain'
option_planner.loc[['Evening'],['Day2']] = 'Visit Thanks Giving Point museum'
option_planner.loc[['Night'],['Day2']] = 'Have a dinner at Cafe Rio mexican restaurant and return to hotel'
option_planner.loc[['Morning'],['Day3']] = 'Have a breakfast at Harvest Restaurant'
option_planner.loc[['Evening'],['Day3']] = 'Go for a shopping at Outlets at Traverse Mountain'
In [60]:
option_planner
Out[60]:
Day1 Day2 Day3
Morning Arriving at Salt Lake City Airport and heading to the hotel Have a breakfast at The Original Pancake House and go for a walk at Murdock Canal Trail - Traverse Mountain Have a breakfast at Harvest Restaurant
Evening Participating IT conference Visit Thanks Giving Point museum Go for a shopping at Outlets at Traverse Mountain
Night Return to the hotel and have a dinner at Tsunami Restaurant & Sushi Bar Have a dinner at Cafe Rio mexican restaurant and return to hotel Heading to the airport

3. Weather


Like mentioned above, the temperture is expected comfortable autumn weather in Lehi, Utah. However, I am going to suggest to pack a winter jacket to the client because the temperture could get dropped as below as 34°F.

In [61]:
climate_oct
Out[61]:
Climate data for Lehi, Utah
October
Average high °F (°C) 64(18)
Average low °F (°C) 34(1)
Average precipitation inches (mm) 1.33(33.8)

Discussion


When I started this project I was expecting to measure travel time but could not find exact timing due to limited resources on public transportation. Thus, the final plan did not reflect the travel time well, which may cause errors in real time planning.

Conclusion


This project can provide guidlines for anyone who is planning to visit Lehi, Utah. Specially FourSquare provides useful information to explore various unvisited areas around Lehi. For example, it may give the distances between the places and reviews which can be helpful for a new visitor. However, despite FourSquare's usefullness, I experienced frustrtion gathering useful information. When trying to search various locations, I continued exceeding my daily limit which slowed down the research project.

Generally speaking, this project taught me to use various tools for data science research in future. Through this project, I plan to establish my portfolio by using and getting used to various data science tools.

In [1]:
from IPython.display import HTML
In [2]:
HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
Out[2]:
In [ ]: